// 很古老的写法，现在都用hooks了
import React, { Component,useContext } from "react";
import PropTypes from "prop-types"; //类型检查
import ReactDOM from "react-dom";
import * as redux from "redux";
import {
  Provider,
  connectAdvanced,
  ReactReduxContext,
  connect,
  // useDispatch,
  // useSelector,
  // useStore,
  createDispatchHook,
  createSelectorHook,
  createStoreHook,
  shallowEqual,
  batch,
} from "react-redux";
import {
  HashRouter as Router,
  Link,
  Route,
  BrowserRouter,
} from "react-router-dom";

import {
  useStore,
  useDispatch,
  useSelector,
  MyProvider,
  MyContext
} from "./store";

console.log(useStore, 11, useDispatch, 22, MyProvider, 33, useSelector)

function Home(props) {
  console.log(props)

  const store = useStore()
  // const dispatch = store.dispatch 
  const dispatch = useDispatch()
  const context = useContext(MyContext) // 这个context下包含了store

  console.log(store.getState())
  debugger
  return (
    <div>
      <ul className="menu">
        <li>
          <Link to="/Home">home</Link>
        </li>
      </ul>
      <div>
        使用useContext 获取到context.store 和 导出的useStore() 获取的store
      </div>
      <div>asdfasdf</div>
    </div>
  );
}
export default Home;
